#pragma once

#include <vector>
#include <string>
#include <functional>
#include <unistd.h>
#include <iostream>
#include "../TcpServer.hpp"

// typedef std::function<void (int, const std::string &, uint16_t)> _func_t;
using _task_t = std::function<void (const std::string&, Connection*)>;

class Task
{
public:
    Task()
    {}

    Task(const std::string& message, Connection* con,  _task_t func)
        :_message(message), _con(con), _func(func)
    {}

    void operator()()
    {
        return _func(_message, _con);
    }

    std::string _message;
    Connection* _con;
    _task_t _func;
};